<template>
  <div class="hot-articles-list">
    <div
      class="hot-articles"
      v-for="h in hotArticlesList"
      :key="h.id"
    >
      <div class="title-item">
        <p class="title">{{h.title}}</p>
        <p class="sub">完整榜单></p>
      </div>
      <div class="text-item">
        <div class="pic">
          <img :src="h.img_url">
        </div>
        <div class="text-content">
          <p><span class="red">1.</span>{{h.contents[0].title}}</p>
          <p><span class="orange">2.</span>{{h.contents[1].title}}</p>
          <p><span class="yellow">3.</span>{{h.contents[2].title}}</p>
        </div>
      </div>
    </div>
    <wd-loading
    color="#000000"
      v-if="loading"
      class="loading"
    ></wd-loading>
  </div>
</template>

<script>
export default {
  name: "HotArticlesList",

  data() {
    return {
      hotArticlesList: [],
      titleOne: "",
      titleTwo: "",
      titleThree: "",
      loading:true,
    };
  },

  mounted() {
    this.getHotArticlesListData();
  },

  methods: {
    //   获取热门榜单数据列表
    getHotArticlesListData() {
      this.$axios
        .get("https://apis.netstart.cn/one/find/rank")
        .then(({ data }) => {
          this.hotArticlesList = data.data;
          console.log(this.hotArticlesList);
          this.$nextTick(()=>{
            this.loading = false;
          })
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.hot-articles-list {
  position: fixed;
  top: 42px;
  left: 0;
  bottom: 0px;
  padding-bottom: 50px;
  width: 100vw;
  //   height: 100vh;
  background-color: #fff;
  overflow: auto;
  box-sizing: border-box;

  .hot-articles {
    padding: 20px 10px;
    .title-item {
      display: flex;
      justify-content: space-between;
      margin-bottom: 20px;
      .title {
        font-weight: 800;
      }
      .sub {
        font-weight: 500;
        font-size: 12px;
        color: #ccc;
      }
    }
    .text-item {
      display: flex;
      align-items: center;
      .pic {
        margin-right: 10px;
        width: 80px;
        height: 80px;
        border-radius: 10px;
        overflow: hidden;
        img {
          display: block;
          width: 100%;
        }
      }
      .text-content {
        //   display:flex;
        //   flex-direction: column;
        //   justify-content: center;
        font-size: 12px;
        p {
          //   margin-bottom: 12px;
          line-height: 2.5em;
          color: #998c8c;
          overflow: hidden;
          white-space: nowrap;
          .red{
              font-weight: 800;
              color: rgb(231, 78, 78);
          }
          .orange{
            //   font-weight: 400;

              color: rgb(197, 110, 38);

          }
          .yellow{
              font-weight: 500;

              color: rgb(214, 196, 27);

          }
        }
      }
    }
  }
}
.loading{
  margin:20px auto; 
}
</style>